<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Page
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: browse.tpl 2010-08-31 17:53 idris $
 * @author     Idris
 */
?>

<?php if( count($this->paginator) > 0 ): ?>

<div class="global_form_box sortby">
	<div class="view_mode">
	  <a class="map" href="javascript:page_manager.setView('map');" title="<?php echo $this->translate("Show on the Map"); ?>"></a>
	  <a class="list_a" href="javascript:page_manager.setView('list');" title="<?php echo $this->translate("Show List"); ?>"></a>
	  <div><?php echo $this->translate("View:"); ?></div>
	  <div class="clr"></div>
	</div>
	<?php echo $this->translate("Sort by"); ?>:
	<a class="page_sort_buttons <?php if ($this->params['sort'] == 'newest') echo 'active'; ?>" id="page_sort_newest" href="javascript:page_manager.setSort('newest');"><?php echo $this->translate("Newest"); ?></a>
	<a class="page_sort_buttons <?php if ($this->params['sort'] == 'popular') echo 'active'; ?>" id="page_sort_popular" href="javascript:page_manager.setSort('popular');"><?php echo $this->translate("Most Popular"); ?></a>
	<a class="page_sort_buttons <?php if ($this->params['sort'] == 'alphabet') echo 'active'; ?>" id="page_sort_alphabet" href="javascript:page_manager.setSort('alphabet');"><?php echo $this->translate("Alphabetically"); ?></a>
	<a id="page_loader_browse" class="page_loader_browse hidden"><?php echo $this->htmlImage($this->baseUrl().'/application/modules/Page/externals/images/loader.gif', ''); ?></a>
</div>

<div class="clr"></div>

		<div style="position: relative;">
			<div id="page_map_cont" style="overflow: hidden;">
				<div id="map_canvas" class="browse_gmap" style="position: absolute; top: 100000px;">
				<?php if (!($this->markers && $this->paginator->getTotalItemCount() > 0)): ?>
				  <ul class="form-notices"><li><?php echo $this->translate('There is no location data'); ?></li></ul>
				<?php endif; ?>
				</div>
			</div>
		</div>
		
		<div id="page_tag_info" class="page_tag_info hidden"></div>
		
		<div class="page_list_items" id="page_list_cont">
     <?php foreach( $this->paginator as $page ): ?>
     <?php $page_id = $page->getIdentity(); ?>
       <div class="page_list_item <?php if ($page->featured) echo "page_list_item_featured"; ?>">
         <table width="100%">
           <tbody>
           	<tr valign="top">
       				<td>
       					<div class="page_list_title"><a href="<?php echo $page->getHref(); ?>"><?php echo $page->getTitle(); ?></a></div>
       					<div class="page_list_info">
       						<div class="l">
	                  <div class="page_list_rating">
	                  <?php echo $this->itemRate('page', $page_id); ?>
	                  </div>
	                  <?php if (!empty($page->category_id)): ?>
	                  <strong><?php echo $this->translate("Category"); ?>:</strong> 
	                  <a href="javascript:page_manager.setCategory(<?php echo $page->category_id; ?>);"><?php echo $page->category; ?></a><br/>
	                  <?php endif; ?>
	                  <?php if (!empty($this->page_likes[$page_id])): ?>
	                  <strong><?php echo $this->translate("Total Likes"); ?>:</strong> <?php echo $this->page_likes[$page_id]; ?><br />
	                  <?php endif; ?>
	                  <?php if (!empty($this->page_tags[$page_id])): ?>
		                  <strong><?php echo $this->translate("Tags"); ?>:</strong>
		                  <?php $counter = 0; ?>
		                  <?php foreach ($this->page_tags[$page_id] as $tag): ?>
		                  <?php $counter++; ?>
		                  <?php if ($counter != 1): ?>,<?php endif; ?>
		                  <a href="javascript:page_manager.setTag(<?php echo $tag['tag_id']; ?>);"><?php echo $tag['text']; ?></a>
		                  <?php endforeach; ?>
		                  <br/>
	                  <?php endif; ?>
                  </div>
                  <div class="r">
	                  <?php if ($page->country || $page->city || $page->state): ?> 
	                  	<div class="page_list_address"><?php echo $page->displayAddress(); ?></div> 
	                  <?php endif; ?>
	                  <?php if ($page->phone): ?>
	                  	<div class="page_list_phone"><?php echo $page->phone; ?></div>
	                  <?php endif; ?>
	                  <?php if ($page->website): ?>
	                  	<div class="page_list_website">
	                  	  <?php echo $page->getWebsite(); ?>
                    	</div>	
	                  <?php endif; ?>
                  <div class="clr"></div>
       					</div>
       					<div class="clr"></div>
       					<div class="page_list_desc"><?php echo $page->getDescription(true); ?></div>
       					<div class="clr"></div>
       					<div class="page_list_submitted"><?php echo $this->translate("Submitted by"); ?> 
       						<a href="<?php echo $page->getOwner()->getHref(); ?>"><?php echo $page->getOwner()->getTitle(); ?></a>, <?php echo $this->translate("updated"); ?> 
       						<?php echo $this->timestamp($page->modified_date); ?> | <?php echo $page->view_count ?> <?php echo $this->translate("views"); ?>
       					</div>
             	</td>
             	<td width="180" align="right">
             		<?php if ($page->featured) : ?> <div class="page_item_featured"><?php echo $this->translate("Sponsored"); ?></div><div class="clr"></div> <?php endif; ?>            		
             		<?php echo $this->htmlLink($page->getHref(), $this->itemPhoto($page, 'thumb.profile', '', array('width' => 175))); ?>
             	</td>
             </tr>
           </tbody>
         </table>
       </div>
     <?php endforeach; ?>
   <?php if( $this->paginator->count() > 1 ): ?>
     <?php echo $this->paginationControl($this->paginator, null, array("pagination/index.tpl","page")); ?>
   <?php endif; ?>
   </div>
   
<?php else: ?>

<div class="tip"><span><?php echo $this->translate("There is no pages."); ?></span></div>

<?php endif; ?>